from app import create_app
from init_data import init_data
import sys
import os

app = create_app()

if __name__ == '__main__':
    if '--init-data' in sys.argv:
        if not os.environ.get('WERKZEUG_RUN_MAIN'):
            with app.app_context():
                try:
                    init_data()
                    print("数据初始化成功！")
                except Exception as e:
                    print(f"数据初始化失败：{str(e)}")
                    sys.exit(1)
<<<<<<< HEAD
                
=======

>>>>>>> 7245172afa54706ac2f9973f27248496e8835d1c
    app.run(host='0.0.0.0', port=5050, debug=True)
